package com.example.qxfw.common.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.qxfw.common.entity.qx.MsgMediumSmallScale;
import com.example.qxfw.common.entity.xt.ContourSetting;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


import java.sql.Timestamp;
import java.util.List;

/************************************
 *
 * @author : HuangDeYin Jolly
 * @since : JDK 11
 * @Date : 2023/8/16  星期三   11:09
 * @description : 此类用来
 ***************************************/
@Mapper
@DS("qx")
public interface MsgmediumsmallscaleMapperXml extends BaseMapper<MsgMediumSmallScale> {
    /**
     * insert record to table
     *
     * @param record the record
     * @return insert count
     */
    int insert(MsgMediumSmallScale record);

    /**
     * insert record to table selective
     *
     * @param record the record
     * @return insert count
     */
    int insertSelective(MsgMediumSmallScale record);

    /************************
     * @Description :
     * @param : strBefTime:前一天数据
     *  strCurTime:当前实况
     *  stationIdList
     * @return : java.util.List<com.example.demo.common.entity.qx.MsgMediumSmallScale>
     ************************/
    List<MsgMediumSmallScale> queryList(@Param("strBefTime") String strBefTime, @Param("strCurTime") String strCurTime, @Param("stationIdList") List<String> stationIdList);

    List<MsgMediumSmallScale> queryFactor(@Param("pdtStart") Timestamp pdtStart, @Param("pdtEnd") Timestamp pdtEnd, @Param("m_strSelDbName1") String m_strSelDbName1, @Param("m_strSelDbName2") String m_strSelDbName2, @Param("city") String city, @Param("stationId") String stationId, @Param("orderBy") String orderBy);

    List<MsgMediumSmallScale> queryTest(@Param("stationId") String stationId, @Param("observTime") String observTime, @Param("rain") Integer rain);

    List<MsgMediumSmallScale> multipleElementQuery(@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime, @Param("station") String station);

    //该时间段的平均温度
    List<MsgMediumSmallScale> selectAvgTemp(@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);
    //该时间段的最高温度
    List<MsgMediumSmallScale> selectMaxTemp(@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);
    //该时间段的最低温度
    List<MsgMediumSmallScale> selectMinTemp(@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);

    //整点温度
    List<MsgMediumSmallScale> selectHourlyTemperature(@Param("time") Timestamp time);

    //整点风
    List<MsgMediumSmallScale> selectHourlyWind(@Param("time") Timestamp time);

    //极大风
    List<MsgMediumSmallScale> selectExtremeWinds(@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);
    //整点湿度
    List<MsgMediumSmallScale> selectHourlyHumidity(@Param("startTime") Timestamp startTime);
    //最小湿度
    List<MsgMediumSmallScale> selectMinimumHumidity(@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);
    //整点气压
    List<MsgMediumSmallScale> selectHourlyAirPressure(@Param("startTime") Timestamp startTime);
    //最小气压
    List<MsgMediumSmallScale> selectAverageAirPressure(@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);

    //整点雨量
    List<MsgMediumSmallScale> selectHourlyRain(@Param("startTime") Timestamp startTime);
    //累积雨量
    List<MsgMediumSmallScale> selectCumulativeRainfall(@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);

    List<MsgMediumSmallScale> selectSingleElementStatisticalChart(@Param("county") String county,@Param("stationName") String stationName,@Param("start") Timestamp start,@Param("end") Timestamp end,@Param("type") String type);

    List<MsgMediumSmallScale> selectStatisticalChartOfAgriculturalStationElements(@Param("stationId") String stationId, @Param("column") String column, @Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);

    @Select("SELECT * FROM contour_setting where elementtype = '${type}' order by elementvalue")
    List<ContourSetting> getContourSetting(String type);

    List<MsgMediumSmallScale> selectSingleElementStatisticalChartDay(String county, String stationName, Timestamp start, Timestamp end, String type, String smalltype);

    Float selectAvgRain(@Param("startTime")Timestamp startTime, @Param("endTime") Timestamp endTime);


    Float selectMaxRain(@Param("startTime")Timestamp startTime,  @Param("endTime")Timestamp endTime);

    String selectMaxStation(@Param("startTime")Timestamp startTime,  @Param("endTime")Timestamp endTime);
}